Telegram Group & Telegram Channel
Блок else в циклах for

Хауди хо, друзья. Практически все новички теряются при виде блока else после циклов, поэтому сейчас немного проясним ситуацию.

В Python блок else может быть представлен не только в условных конструкциях после if, но и в циклах после for и while. В данном случае код внутри else выполняется, только если цикл не был прерван с помощью break.

Типичный пример использования – поиск чего-либо в цикле с использованием ключевого слова break при нахождении, как показано на картинке. Исходный код текстом можете найти в нашем чате.



tg-me.com/python_academy/38
Create:
Last Update:

Блок else в циклах for

Хауди хо, друзья. Практически все новички теряются при виде блока else после циклов, поэтому сейчас немного проясним ситуацию.

В Python блок else может быть представлен не только в условных конструкциях после if, но и в циклах после for и while. В данном случае код внутри else выполняется, только если цикл не был прерван с помощью break.

Типичный пример использования – поиск чего-либо в цикле с использованием ключевого слова break при нахождении, как показано на картинке. Исходный код текстом можете найти в нашем чате.

BY Python Academy




Share with your friend now:
tg-me.com/python_academy/38

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

Unlimited members in Telegram group now

Telegram has made it easier for its users to communicate, as it has introduced a feature that allows more than 200,000 users in a group chat. However, if the users in a group chat move past 200,000, it changes into "Broadcast Group", but the feature comes with a restriction. Groups with close to 200k members can be converted to a Broadcast Group that allows unlimited members. Only admins can post in Broadcast Groups, but everyone can read along and participate in group Voice Chats," Telegram added.

Telegram has exploded as a hub for cybercriminals looking to buy, sell and share stolen data and hacking tools, new research shows, as the messaging app emerges as an alternative to the dark web.An investigation by cyber intelligence group Cyberint, together with the Financial Times, found a ballooning network of hackers sharing data leaks on the popular messaging platform, sometimes in channels with tens of thousands of subscribers, lured by its ease of use and light-touch moderation.Python Academy from us


Telegram Python Academy
FROM USA